//
//  LettersPanelComponent.m
//  AsyncImages
//
//  Created by Matthew on 12-1-25.
//  Copyright 2012年 develop4u.gr. All rights reserved.
//

#import "LettersPanelComponent.h"


@implementation LettersPanelComponent

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        self.backgroundColor = [UIColor whiteColor];
        

    }
    return self;
}

- (void) initPanel:(NSString *) inSuffix
{
    // Initialization code
    int colNum = 9;
    //int rowNum  = 3;
    
    int unitWidth = 33;
    int unitTweenWidth = 3;
    
    int unitHeight = 40;
    int unitTweenHeight = 5;
    
    NSMutableArray *letterArr = [[NSMutableArray alloc] initWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",Nil];
    
    for (int i = 0; i<26 ; i++) 
    {
        LetterButton *letterBtn = [[LetterButton alloc] initWithFrame:CGRectMake((i%colNum)*(unitWidth+unitTweenWidth),floor(i/colNum)*(unitHeight+unitTweenHeight), unitWidth, unitHeight)];
        [letterBtn addLetter: [letterArr objectAtIndex:i]
                 letterWidth:35
                        offX:0
                        offY:3
                      suffix:inSuffix];
        [self addSubview:letterBtn];
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

- (void)dealloc
{
    [super dealloc];
}

@end
